<&contentdata section_name = 'settings' page_name = 'log_consolidation' author = 'mrmt32' type = 'page' >

Router Log Consolidation

<&javascript delayed='true'> SendCommandToServer({action:'get_consolidation_rules'}, function(jsonResponse) { if (jsonResponse.isError) { $("#consolidationForm").html(jsonResponse.ErrorString); } else { $("#consolidationForm").submit(function(e) { e.preventDefault(); e.stopPropagation(); // Fist find which items where removed: var removedItems = ""; $("tr.disabled").each(function(index, domElement) { removedItems += (index == 0? "":";") + $(domElement).attr("consolid"); }); // Now find items that are not removed (so they can be updated or inserted var newItems = ""; $("tr:not(.disabled):has(input)").each(function(index, domElement) { var id = $(domElement).attr("consolid"); // Calculate time in seconds var timeBeforeFormated = $(this).find("input[name=timeBefore]").val(); var timeBeforeMultiple = $(this).find("select[name=timeBeforeType] option:selected").val(); var timeBefore = Math.round(timeBeforeFormated * (timeBeforeMultiple / 1000)); var resolutionFormated = $(this).find("input[name=resolution]").val(); var resolutionMultiple = $(this).find("select[name=resolutionType] option:selected").val(); var resolution = Math.round(resolutionFormated * (resolutionMultiple / 1000)); newItems += (index == 0? "":";") + timeBefore + ":" + resolution + (isset(id)? ":" + id : ""); }); $.post(InterfaceLocation + "?action=set_consolidation_rules", {update: newItems, 'delete': removedItems}, function(jsonResponse) { ParseContentData(window.ContentData.blocks.settings_change_status_block, {jsonResponse:jsonResponse, dontShowValues: true}, function (output) { $(".settingsPage").html(output); }); }, "json"); ParseContentData(window.ContentData.blocks.loading_text_block, {}, function (output) { $(".settingsPage").html(output); }); return false; }); ParseContentData(window.ContentData.blocks.consolidation_settings_form_block, {ReturnData: jsonResponse.ReturnData}, function(output) { $("#consolidationForm").html(output); }) } }); <&/javascript>
<&/contentdata> <&contentdata block_name = 'consolidation_settings_form_block' author = 'mrmt32' type = 'block' >

Router Consolidation Rules

These rules govern how Sky Router Tool will consolidate your logs over time (to save space).

WARNING: These rules are retroactive and will take effect immediatly; make sure they are correct before saving them! You may lose data otherwise.

<&javascript delayed='true'> // Gets an optimum time value in either min/sec/days/years etc function getTimeValue (time) { if (time >= 31536000000) { // Time is greater than or equal to 1 year this.type = "Years"; this.time = time / 31536000000; } else if (time >= 2419200000) { // Time is greater than or equal to 28 days (~1 month) this.type = "Months"; this.time = time / 2419200000; } else if (time >= 604800000000) { // Time is greater than or equal to 1 week this.type = "Weeks"; this.time = time / 604800000; } else if (time >= 86400000) { // Time is greater than or equal to 1 day this.type = "Days"; this.time = time / 86400000; } else if (time >= 3600000) { // Time is greater than or equal to 1 hour this.type = "Hours"; this.time = time / 3600000; } else if (time >= 60000) { // Time is greater than or equal to 1 minute this.type = "Minutes"; this.time = time / 60000; } else { this.type = "Seconds"; this.time = time / 1000; } return this; } function createTimeOptions(name, defaultType) { var result = ""; var options = ['Seconds', 'Minutes', 'Hours', 'Days' , 'Weeks' , 'Months' , 'Years' ]; var values = [1000 , 60000 , 3600000, 86400000, 604800000, 2419200000, 31536000000]; result += ""; return result; } for ( i in parameters.ReturnData ) { var consolidationPeriod = parameters.ReturnData[i]; var timeBefore = new getTimeValue(consolidationPeriod.Period); var resolution = new getTimeValue(consolidationPeriod.Resolution); output = ""; output += ""; output += " "; output += " "; output += " "; output += ""; $("#consolTableBody").append(output); // Add remove button event handler $("tr[consolid='" + consolidationPeriod.Id + "'] button.removeButton").bind('click', {id: consolidationPeriod.Id}, function(e) { if ($(this).html() == "Remove") { $(this).html("Undo"); $("tr[consolid='" + e.data.id + "']").toggleClass("disabled", true); $("tr[consolid='" + e.data.id + "'] input").attr("disabled", true); $("tr[consolid='" + e.data.id + "'] select").attr("disabled", true); } else { $(this).html("Remove"); $("tr[consolid='" + e.data.id + "']").toggleClass("disabled", false); $("tr[consolid='" + e.data.id + "'] input").attr("disabled", false); $("tr[consolid='" + e.data.id + "'] select").attr("disabled", false); } }); } window.log_consolidation_table_count = parameters.ReturnData.length; $("#consolTableBody").append(""); $(".addButton").click(function() { output = ""; output += ""; output += " "; output += " "; output += " "; output += ""; $("#consolTableBody").append(output); $("#newitem_" + window.log_consolidation_table_count + " button.removeButton").bind('click', {item: "#newitem_" + window.log_consolidation_table_count}, function(e) { $(e.data.item).remove(); }); window.log_consolidation_table_count++; }); <&/javascript>
Consolidate BeforeTo a resolution of
"; output += createTimeOptions("timeBeforeType", timeBefore.type) + " ago "; output += createTimeOptions("resolutionType", resolution.type) + " per measurement.
"; output += createTimeOptions("timeBeforeType", "Seconds") + " ago "; output += createTimeOptions("resolutionType", "Seconds") + " per measurement.

<&/contentdata>